package com.webservicedemo.config;

import javax.xml.ws.Endpoint;

import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.webservicedemo.ws.MathematicalCalculation;

@Configuration
public class WebConfig {
	@Autowired
    private Bus bus;
	
	//这里最好还是名字区短一点
	@Autowired
	private MathematicalCalculation mc;
	/**
	 * publish把服务名称加进去就可以了
	 * 需要注意将返回的对象注入到容器中
	 * @return
	 */
	@Bean
	public Endpoint autoConfig(){
		EndpointImpl end = new EndpointImpl(bus,mc);
		end.publish("/MathService");
		return end;
	}
}
